import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LockSerialnumVO, LockSerialnumForm, LockSerialnumQuery } from '@/api/tearoom/lockSerialnum/types';

/**
 * 查询门锁配置序号列表
 * @param query
 * @returns {*}
 */

export const listLockSerialnum = (query?: LockSerialnumQuery): AxiosPromise<LockSerialnumVO[]> => {
  return request({
    url: '/tearoom/lockSerialnum/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询门锁配置序号详细
 * @param teroomId
 */
export const getLockSerialnum = (teroomId: string | number): AxiosPromise<LockSerialnumVO> => {
  return request({
    url: '/tearoom/lockSerialnum/' + teroomId,
    method: 'get'
  });
};

/**
 * 新增门锁配置序号
 * @param data
 */
export const addLockSerialnum = (data: LockSerialnumForm) => {
  return request({
    url: '/tearoom/lockSerialnum',
    method: 'post',
    data: data
  });
};

/**
 * 修改门锁配置序号
 * @param data
 */
export const updateLockSerialnum = (data: LockSerialnumForm) => {
  return request({
    url: '/tearoom/lockSerialnum',
    method: 'put',
    data: data
  });
};

/**
 * 删除门锁配置序号
 * @param teroomId
 */
export const delLockSerialnum = (teroomId: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/lockSerialnum/' + teroomId,
    method: 'delete'
  });
};
